import battlegui.Orientation;
import battlegui.Position;

/**
 * The test class TestHut.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class TestHut extends junit.framework.TestCase
{
    private static Hut hut1;
    private static Hut hut2;
    
    /**
     * Default constructor for test class TestHut
     */
    public TestHut()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    protected void setUp()
    {
        Position position1 = new Position(15,10);
        Position position2 = new Position(5, 16);
        hut1 = new Hut(4, Orientation.HORIZONTAL, position1);
        hut2 = new Hut(2, Orientation.VERTICAL, position2);
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    protected void tearDown()
    {
    }
    
    /**
     * Test de methode getOrientation.
     */
    public void testgetOrientation()
    {
        assertEquals(Orientation.HORIZONTAL, hut1.getOrientation());
        assertEquals(Orientation.VERTICAL, hut2.getOrientation());
    }
    
    /**
     * Test de methode getlength.
     */
    public void testgetLength()
    {
        assertEquals(2, hut2.getLength());
        assertEquals(4, hut1.getLength());
    }
    
    /**
     * Test de methode getPosition
     */
    public void testgetPosition()
    {
        assertEquals("Position(x=15, y=10)", hut1.getPosition().toString());
        assertEquals("Position(x=5, y=16)", hut2.getPosition().toString());
    }
    
    /**
     * Test de methode isHit
     */
    public void testisHit()
    {
        assertEquals(true,hut1.isHit(new Position(15,10)));
        assertEquals(true,hut1.isHit(new Position(17,10)));
        assertEquals(false,hut1.isHit(new Position(14,10)));
        
        assertEquals(true,hut2.isHit(new Position(5,15)));
        assertEquals(false,hut2.isHit(new Position(4,16)));
    }
}
